import { defineStore } from "pinia"

export const useChatwebsocketStore = defineStore('ws', {
  state: () => ({
    isConnected: 0,
    message: "",
    isClear: 0
  }),
  actions: {
    changeIsConnected() {
      this.isConnected++
    },
    setMessage(val) {
      this.message = val
    },
    clearMessage() {
      this.message = ""
    },
    changeIsClear() {
      this.isClear++
    }
  },
  persist: {
    enabled: true  //开启数据缓存
  }
})